﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace EchoPlanNote.Common
{
    public static class ExeFunc
    {
        /// <summary>
        /// 对该字符串进行MD5加密
        /// </summary>
        /// <param name="sourceStr">源字符串</param>
        /// <returns></returns>
        public static string GetMD5(this string sourceStr)
        {
            StringBuilder sb = new StringBuilder();
            MD5 md5 = MD5.Create();
            byte[] result = md5.ComputeHash(Encoding.UTF8.GetBytes(sourceStr));
            foreach (var item in result)
            {
                sb.Append(item.ToString("x2"));
            }
            return sb.ToString();
        }
    }
}
